package com.topisv.tms.repository.stock.instorage;

import java.util.Date;
import java.util.List;

import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

import com.topisv.tms.entity.stock.instorage.OutstorageInfo;

/**
 * 出库信息_dao
 * @author ch
 *
 */
public interface OutstorageInfoDao extends PagingAndSortingRepository<OutstorageInfo, Long>, JpaSpecificationExecutor<OutstorageInfo> {

	@Query("select t from OutstorageInfo t where t.taskCode=?1 and t.sku=?2")
	OutstorageInfo loadByTaskCode(String taskCode,String sku);
	
	
//	@Query("select t from OutstorageInfo t where  t.opeTime >= ?1 and t.opeTime <= ?2 AND NOT EXISTS (select 1 from AlreadyDeductedOut t1 where t.id = t1.outinstorageId and t.num = t1.alreadyDeductedNum) order by t.opeTime asc ")
//	List<OutstorageInfo> loadBy30DayWithinRecord(Date startTime,Date endTime);

	@Query("select t from OutstorageInfo t where  t.opeTime >= ?1 and t.opeTime <= ?2 order by t.opeTime asc ")
	List<OutstorageInfo> loadBy30DayWithinRecord(Date startTime,Date endTime);
}
